package org.dllwh.alibaba.nacos.plugin.datasource.dialect;


import org.dllwh.alibaba.nacos.plugin.datasource.constants.DatabaseTypeConstant;

/**
 * 把今天最好的表现当作明天最新的起点．．～
 * <p>
 * Today the best performance as tomorrow the newest starter!
 *
 * @ClassName OracleDatabaseDialect
 * @Description TODO(这里用一句话描述这个类的作用)
 * @Date 2025-10-09 10:45
 * @版本 V 1.0.1
 * @see <a href="">TODO(连接内容简介)</a>
 * @since JDK 17
 */
public class OracleDatabaseDialect extends AbstractDatabaseDialect {


    @Override
    public String getType() {
        return DatabaseTypeConstant.ORACLE;
    }
    @Override
    public String getLimitTopSqlWithMark(String sql) {
        return sql + " FETCH FIRST ? ROWS ONLY ";
    }

    @Override
    public String getLimitPageSqlWithMark(String sql) {
        return sql + " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY ";
    }

    @Override
    public String getLimitPageSqlWithOffset(String sql, int startOffset, int pageSize) {
        return sql + "  OFFSET " + startOffset + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY ";
    }

    @Override
    public String getLimitPageSql(String sql, int pageNo, int pageSize) {
        return sql + "  OFFSET " + getPagePrevNum(pageNo, pageSize) + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY ";
    }
}
